PresetLoader{

	var <>preset, <>alreadyLoaded = false, <>defaults, returnVal, presetAt, defaultsAt;
	
	getVal{
	
		arg index, val;
		
		if(
			preset != nil,
			{presetAt = preset[index]}
		);
		
		if(
		
			defaults != nil,
			{defaultsAt = defaults[index]}
		
		);
		
		if(
		
			index == nil,
			{ returnVal = val},
			{if(
				
				(preset == nil) || (presetAt == nil),
				{if(
					(defaults == nil) || (defaultsAt == nil),
					{returnVal = val},
					{returnVal = defaults[index]}
				)},
				{returnVal = preset[index]} 
				
			)}
		
		);
		
		if(returnVal == nil){
			returnVal = 0;
		}
		
		^returnVal;
		
	
	}
	
	

}